"""
基础数据模型
"""
from datetime import datetime
from tortoise.models import Model
from tortoise import fields


class BaseModel(Model):
    """基础模型类，包含通用字段"""
    
    id = fields.IntField(pk=True, description="主键ID")
    created_at = fields.DatetimeField(auto_now_add=True, description="创建时间")
    updated_at = fields.DatetimeField(auto_now=True, description="更新时间")
    is_active = fields.BooleanField(default=True, description="是否激活")
    
    class Meta:
        abstract = True


class TimestampMixin:
    """时间戳混入类"""
    created_at = fields.DatetimeField(auto_now_add=True, description="创建时间")
    updated_at = fields.DatetimeField(auto_now=True, description="更新时间")


class SoftDeleteMixin:
    """软删除混入类"""
    is_deleted = fields.BooleanField(default=False, description="是否已删除")
    deleted_at = fields.DatetimeField(null=True, description="删除时间")
